/*
*	(*^。^*) TFrameWork License (*^。^*)
*/

/*
 *  Title :  
 *          
 *  Description :  
 *          
 *          
 *  Date : 
 *
 *  Author : DengPing
 *
 *  Modify : 
 */

using UnityEngine;

namespace TFrameWork.Module.ActionEditor
{
    [System.Serializable,ShowCreateName("创建粒子特性")]
    public class ParticlePrefabEvent : PrefabEvent
    {
        public override int GetDefaultDuration()
        {
            float duration = 1.0f / 30.0f;
#if UNITY_EDITOR
            if (prefab == null) return (int)(duration * 30);
            var ps = prefab.GetComponentsInChildren<ParticleSystem>();
            foreach (var p in ps)
            {
                if (p.main.duration > duration) duration = p.main.duration;
            }

#endif

            return (int)duration * 30;
        }

        public override object Clone()
        {
            return base.Clone();
        }
    }
}
